WIP - verify GH action tag/SHA combinations #356
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change introduces a new function
verify_actionsto validate the contents against GitHub.TL;DR
The function verifies that the SHAs specified in
actions.ymlexist in the GH repo. Also ensures that the SHA exists on the Git tag, if thetagattribute is specified. The rest of the (currently spaghetti code) function is a lot of output and error(failure) and warning collection.Although it issues quite a few GH API requests, the rate limiter should not kick in (with an authenticated GH token). I opted to rely on the HTTP/1.1
urllib.requeststuff, which has no connection-reuse. The alternative would have been to add a dependency.The algorithm roughly works like this, for each action specified in
actions.yml:OWNER/*("wildcard" repository). Can't verify Git SHAs in this case.docker:*(not implemented)OWNER/REPOpattern.Then, for each reference for an action:
tagis specified, let GH resolve the commit SHA. Emit a warning to add the value of thetagattribute, if the SHA can be resolved. Otherwise, emit an error.tagis specified:Fixes #110